<template>
  <div>
    <div class="shangpin" v-for="(item, index) in deliveryArr" :key="index">
      <div class="shangpin_tops">
        <span>商品描述</span>
        <van-icon name="arrow" class="b1" />
      </div>

      <div class="content">
        <div class="photo">
          <img src="../assets/我的客户.png" alt="" />
        </div>
        <ul>
          <li>{{ item.title }}</li>
          <li>
            <p>下单时间</p>
            <p>{{ item.orderTime }}</p>
          </li>
          <li>
            <p>下单人</p>
            <p>{{ item.orderUserName }}</p>
          </li>
        </ul>
      </div>

      <div class="foots">
        <van-button class="van_btn" color="blue" round @click="btnTo(item)">发货</van-button>
        <!-- :to="`/delivey2?item=${item}`" -->
      </div>
    </div>
  </div>
</template>

<script>
import bus from "@/assets/event-bus.js";
import { getDelivery } from "@/request/api";

export default {
  name: "Delivery",
  // props: {
  //   active: { type: Number },
  // },
  data() {
    return {
      deliveryArr: [],
    };
  },
  created() {
    // console.log(`父组件传过来的active: ${this.active}`);
    getDelivery({
      current: 1,
      size: 20,
      keyword: "",
    }).then((res) => {
      console.log(res.data);
      this.deliveryArr = res.data.records;
    });
  },
  methods: {
    btnTo(item) {
      this.$router.push({ name: "Delivey2", params: item });
    },
  },
};
</script>

<style scoped>
.shangpin {
  background: #fff;
  margin-bottom: 0.5rem;
}
.shangpin_tops {
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  margin-top: 0.5rem;
}
span,
.b1 {
  padding: 0.8rem 0;
}
.content {
  background: #fff;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  display: flex;
  padding: 1rem;
}
.photo {
  flex: 1;
}
.content ul {
  flex: 4;
}
.content ul li {
  display: flex;
}
.photo img {
  width: 80%;
}
.foots {
  padding: 0.5rem 0;
}
.van_btn{
  padding: 0 1.8rem;
  margin-left: 70%;
}
</style>